<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Jetson Inference: gstCamera Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="NVLogo_2D.jpg"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Jetson Inference
   </div>
   <div id="projectbrief">DNN Vision Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classgstCamera.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="classgstCamera-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">gstCamera Class Reference<div class="ingroups"><a class="el" href="group__util.html">Utilities Library (jetson-utils)</a> &raquo; <a class="el" href="group__camera.html">Camera Capture</a> &raquo; <a class="el" href="group__gstCamera.html">gstCamera</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>MIPI CSI and V4L2 camera capture using GStreamer and <code>nvarguscamerasrc</code> or <code>v4l2src</code> elements.  
 <a href="classgstCamera.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="gstCamera_8h_source.html">gstCamera.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1df842937128e70d8f140c65e88e783c"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a1df842937128e70d8f140c65e88e783c">~gstCamera</a> ()</td></tr>
<tr class="memdesc:a1df842937128e70d8f140c65e88e783c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release the camera interface and resources.  <a href="#a1df842937128e70d8f140c65e88e783c">More...</a><br /></td></tr>
<tr class="separator:a1df842937128e70d8f140c65e88e783c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a075aa94acb72f577f7c385e37a8c15b0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a075aa94acb72f577f7c385e37a8c15b0">Open</a> ()</td></tr>
<tr class="memdesc:a075aa94acb72f577f7c385e37a8c15b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Begin streaming the camera.  <a href="#a075aa94acb72f577f7c385e37a8c15b0">More...</a><br /></td></tr>
<tr class="separator:a075aa94acb72f577f7c385e37a8c15b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8043c610d01bcde93f212f5f5bb0fe1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#af8043c610d01bcde93f212f5f5bb0fe1">Close</a> ()</td></tr>
<tr class="memdesc:af8043c610d01bcde93f212f5f5bb0fe1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stop streaming the camera.  <a href="#af8043c610d01bcde93f212f5f5bb0fe1">More...</a><br /></td></tr>
<tr class="separator:af8043c610d01bcde93f212f5f5bb0fe1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7142cbf3d2251c023967affa0625ac74"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a7142cbf3d2251c023967affa0625ac74">IsStreaming</a> () const</td></tr>
<tr class="memdesc:a7142cbf3d2251c023967affa0625ac74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the camera is streaming or not.  <a href="#a7142cbf3d2251c023967affa0625ac74">More...</a><br /></td></tr>
<tr class="separator:a7142cbf3d2251c023967affa0625ac74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ae42b24f1ccb8056252614aae6779e5"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5">Capture</a> (void **cpu, void **cuda, uint64_t timeout=UINT64_MAX)</td></tr>
<tr class="memdesc:a1ae42b24f1ccb8056252614aae6779e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Capture the next image frame from the camera.  <a href="#a1ae42b24f1ccb8056252614aae6779e5">More...</a><br /></td></tr>
<tr class="separator:a1ae42b24f1ccb8056252614aae6779e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a93371e3811a1956ff96c154fd1da23f2"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a93371e3811a1956ff96c154fd1da23f2">CaptureRGBA</a> (float **image, uint64_t timeout=UINT64_MAX, bool zeroCopy=false)</td></tr>
<tr class="memdesc:a93371e3811a1956ff96c154fd1da23f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Capture the next image frame from the camera and convert it to float4 RGBA format, with pixel intensities ranging between 0.0 and 255.0.  <a href="#a93371e3811a1956ff96c154fd1da23f2">More...</a><br /></td></tr>
<tr class="separator:a93371e3811a1956ff96c154fd1da23f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ca28a9fc888afe4ff0a6542de351f56"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a4ca28a9fc888afe4ff0a6542de351f56">ConvertRGBA</a> (void *input, float **output, bool zeroCopy=false)</td></tr>
<tr class="memdesc:a4ca28a9fc888afe4ff0a6542de351f56"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert an image to float4 RGBA that was previously aquired with <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a>.  <a href="#a4ca28a9fc888afe4ff0a6542de351f56">More...</a><br /></td></tr>
<tr class="separator:a4ca28a9fc888afe4ff0a6542de351f56"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a01e94b6f2abedad9ab760dd68b828e80"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a01e94b6f2abedad9ab760dd68b828e80">GetWidth</a> () const</td></tr>
<tr class="memdesc:a01e94b6f2abedad9ab760dd68b828e80"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the width of the camera.  <a href="#a01e94b6f2abedad9ab760dd68b828e80">More...</a><br /></td></tr>
<tr class="separator:a01e94b6f2abedad9ab760dd68b828e80"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8c0cbb34989ca19042be8b90c176fc47"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a8c0cbb34989ca19042be8b90c176fc47">GetHeight</a> () const</td></tr>
<tr class="memdesc:a8c0cbb34989ca19042be8b90c176fc47"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the height of the camera.  <a href="#a8c0cbb34989ca19042be8b90c176fc47">More...</a><br /></td></tr>
<tr class="separator:a8c0cbb34989ca19042be8b90c176fc47"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe5444efa860b29c8ce2dff6e3e16dcd"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#abe5444efa860b29c8ce2dff6e3e16dcd">GetPixelDepth</a> () const</td></tr>
<tr class="memdesc:abe5444efa860b29c8ce2dff6e3e16dcd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the pixel bit depth of the camera (measured in bits).  <a href="#abe5444efa860b29c8ce2dff6e3e16dcd">More...</a><br /></td></tr>
<tr class="separator:abe5444efa860b29c8ce2dff6e3e16dcd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6f02cf79d67b1c204f53a1c7fa369374"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a6f02cf79d67b1c204f53a1c7fa369374">GetSize</a> () const</td></tr>
<tr class="memdesc:a6f02cf79d67b1c204f53a1c7fa369374"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the size (in bytes) of a camera frame from <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a>.  <a href="#a6f02cf79d67b1c204f53a1c7fa369374">More...</a><br /></td></tr>
<tr class="separator:a6f02cf79d67b1c204f53a1c7fa369374"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a1747140a15dd83dbd3593c375bbc85d0"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classgstCamera.html">gstCamera</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a1747140a15dd83dbd3593c375bbc85d0">Create</a> (const char *camera=NULL)</td></tr>
<tr class="memdesc:a1747140a15dd83dbd3593c375bbc85d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a MIPI CSI or V4L2 camera device.  <a href="#a1747140a15dd83dbd3593c375bbc85d0">More...</a><br /></td></tr>
<tr class="separator:a1747140a15dd83dbd3593c375bbc85d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4e35c53ac1d65ba5c0319278ca097766"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classgstCamera.html">gstCamera</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a4e35c53ac1d65ba5c0319278ca097766">Create</a> (uint32_t width, uint32_t height, const char *camera=NULL)</td></tr>
<tr class="memdesc:a4e35c53ac1d65ba5c0319278ca097766"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a MIPI CSI or V4L2 camera device.  <a href="#a4e35c53ac1d65ba5c0319278ca097766">More...</a><br /></td></tr>
<tr class="separator:a4e35c53ac1d65ba5c0319278ca097766"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:a211a6c9359a2f43054771f15e7628a5e"><td class="memItemLeft" align="right" valign="top">static const uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a211a6c9359a2f43054771f15e7628a5e">DefaultWidth</a> = 1280</td></tr>
<tr class="memdesc:a211a6c9359a2f43054771f15e7628a5e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default camera width, unless otherwise specified during <a class="el" href="classgstCamera.html#a1747140a15dd83dbd3593c375bbc85d0" title="Create a MIPI CSI or V4L2 camera device. ">Create()</a>  <a href="#a211a6c9359a2f43054771f15e7628a5e">More...</a><br /></td></tr>
<tr class="separator:a211a6c9359a2f43054771f15e7628a5e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a42ab558b8ff9a0bf47b768c5122825b7"><td class="memItemLeft" align="right" valign="top">static const uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classgstCamera.html#a42ab558b8ff9a0bf47b768c5122825b7">DefaultHeight</a> = 720</td></tr>
<tr class="memdesc:a42ab558b8ff9a0bf47b768c5122825b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default camera height, unless otherwise specified during <a class="el" href="classgstCamera.html#a1747140a15dd83dbd3593c375bbc85d0" title="Create a MIPI CSI or V4L2 camera device. ">Create()</a>  <a href="#a42ab558b8ff9a0bf47b768c5122825b7">More...</a><br /></td></tr>
<tr class="separator:a42ab558b8ff9a0bf47b768c5122825b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>MIPI CSI and V4L2 camera capture using GStreamer and <code>nvarguscamerasrc</code> or <code>v4l2src</code> elements. </p>
<p><a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> supports both MIPI CSI cameras and V4L2-compliant devices like USB webcams.</p>
<p>Examples of MIPI CSI cameras that work out of the box are the OV5693 module from the Jetson TX1/TX2 devkits, and the IMX219 sensor from the Raspberry Pi Camera Module v2.</p>
<p>For MIPI CSI cameras, the GStreamer element <code>nvarguscamerasrc</code> will be used for capture. For V4L2 devices, the GStreamer element <code>v4l2src</code> will be used for camera capture.</p>
<p><a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> uses CUDA underneath for any necessary colorspace conversion, and provides the captured image frames in CUDA device memory, or zero-copy shared CPU/GPU memory. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a1df842937128e70d8f140c65e88e783c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1df842937128e70d8f140c65e88e783c">&#9670;&nbsp;</a></span>~gstCamera()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">gstCamera::~gstCamera </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Release the camera interface and resources. </p>
<p>Destroying the camera will also <a class="el" href="classgstCamera.html#af8043c610d01bcde93f212f5f5bb0fe1" title="Stop streaming the camera. ">Close()</a> the stream if it is still open. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a1ae42b24f1ccb8056252614aae6779e5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1ae42b24f1ccb8056252614aae6779e5">&#9670;&nbsp;</a></span>Capture()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool gstCamera::Capture </td>
          <td>(</td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>cpu</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>cuda</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>timeout</em> = <code>UINT64_MAX</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Capture the next image frame from the camera. </p>
<p>For MIPI CSI cameras, <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> will provide an image in YUV (NV12) format. For V4L2 devices, <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> will provide an image in RGB (24-bit) format.</p>
<p>The captured images reside in shared CPU/GPU memory, also known as CUDA mapped memory or zero-copy memory. Hence it is unnessary to copy them to GPU. This memory is managed internally by <a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a>, so don't attempt to free it.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">cpu</td><td>Pointer that gets returned to the image in CPU address space. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">cuda</td><td>Pointer that gets returned to the image in GPU address space.</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The time in milliseconds for the calling thread to wait to return if a new camera frame isn't recieved by that time. If timeout is 0, the calling thread will return immediately if a new frame isn't already available. If timeout is UINT64_MAX, the calling thread will wait indefinetly for a new frame to arrive (this is the default behavior).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if a frame was successfully captured, otherwise <code>false</code> if a timeout or error occurred, or if timeout was 0 and a frame wasn't ready. </dd></dl>

</div>
</div>
<a id="a93371e3811a1956ff96c154fd1da23f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a93371e3811a1956ff96c154fd1da23f2">&#9670;&nbsp;</a></span>CaptureRGBA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool gstCamera::CaptureRGBA </td>
          <td>(</td>
          <td class="paramtype">float **&#160;</td>
          <td class="paramname"><em>image</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>timeout</em> = <code>UINT64_MAX</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>zeroCopy</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Capture the next image frame from the camera and convert it to float4 RGBA format, with pixel intensities ranging between 0.0 and 255.0. </p>
<p>Internally, <a class="el" href="classgstCamera.html#a93371e3811a1956ff96c154fd1da23f2" title="Capture the next image frame from the camera and convert it to float4 RGBA format, with pixel intensities ranging between 0.0 and 255.0. ">CaptureRGBA()</a> first calls <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> and then <a class="el" href="classgstCamera.html#a4ca28a9fc888afe4ff0a6542de351f56" title="Convert an image to float4 RGBA that was previously aquired with Capture(). ">ConvertRGBA()</a>. The <a class="el" href="classgstCamera.html#a4ca28a9fc888afe4ff0a6542de351f56" title="Convert an image to float4 RGBA that was previously aquired with Capture(). ">ConvertRGBA()</a> function uses CUDA, so if you want to capture from a different thread than your CUDA device, use the <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> and <a class="el" href="classgstCamera.html#a4ca28a9fc888afe4ff0a6542de351f56" title="Convert an image to float4 RGBA that was previously aquired with Capture(). ">ConvertRGBA()</a> functions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">image</td><td>Pointer that gets returned to the image in GPU address space, or if the zeroCopy parameter is true, then the pointer is valid in both CPU and GPU address spaces. Do not manually free the image memory, it is managed internally. The image is in float4 RGBA format. The size of the image is: <code><a class="el" href="classgstCamera.html#a01e94b6f2abedad9ab760dd68b828e80" title="Return the width of the camera. ">GetWidth()</a> * <a class="el" href="classgstCamera.html#a8c0cbb34989ca19042be8b90c176fc47" title="Return the height of the camera. ">GetHeight()</a> * sizeof(float) * 4</code></td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout</td><td>The time in milliseconds for the calling thread to wait to return if a new camera frame isn't recieved by that time. If timeout is 0, the calling thread will return immediately if a new frame isn't already available. If timeout is UINT64_MAX, the calling thread will wait indefinetly for a new frame to arrive (this is the default behavior).</td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">zeroCopy</td><td>If <code>true</code>, the image will reside in shared CPU/GPU memory. If <code>false</code>, the image will only be accessible from the GPU. You would need to set zeroCopy to <code>true</code> if you wanted to access the image pixels from the CPU. Since this isn't generally the case, the default is <code>false</code> (GPU only).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if a frame was successfully captured, otherwise <code>false</code> if a timeout or error occurred, or if timeout was 0 and a frame wasn't ready. </dd></dl>

</div>
</div>
<a id="af8043c610d01bcde93f212f5f5bb0fe1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8043c610d01bcde93f212f5f5bb0fe1">&#9670;&nbsp;</a></span>Close()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void gstCamera::Close </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stop streaming the camera. </p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="classgstCamera.html#af8043c610d01bcde93f212f5f5bb0fe1" title="Stop streaming the camera. ">Close()</a> is automatically called by the camera's destructor when it gets deleted, so you do not explicitly need to call <a class="el" href="classgstCamera.html#af8043c610d01bcde93f212f5f5bb0fe1" title="Stop streaming the camera. ">Close()</a> before exiting the program if you delete your camera object. </dd></dl>

</div>
</div>
<a id="a4ca28a9fc888afe4ff0a6542de351f56"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4ca28a9fc888afe4ff0a6542de351f56">&#9670;&nbsp;</a></span>ConvertRGBA()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool gstCamera::ConvertRGBA </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>input</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float **&#160;</td>
          <td class="paramname"><em>output</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>zeroCopy</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert an image to float4 RGBA that was previously aquired with <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a>. </p>
<p>This function uses CUDA to perform the colorspace conversion to float4 RGBA, with pixel intensities ranging from 0.0 to 255.0.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">input</td><td>Pointer to the input image, typically the pointer from <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a>. If this is a MIPI CSI camera, it's expected to be in YUV (NV12) format. If this is a V4L2 device, it's expected to be in RGB (24-bit) format. In both cases, these are the formats that <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> provides the image in.</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">output</td><td>Pointer that gets returned to the image in GPU address space, or if the zeroCopy parameter is true, then the pointer is valid in both CPU and GPU address spaces. Do not manually free the image memory, it is managed internally. The image is in float4 RGBA format. The size of the image is: <code><a class="el" href="classgstCamera.html#a01e94b6f2abedad9ab760dd68b828e80" title="Return the width of the camera. ">GetWidth()</a> * <a class="el" href="classgstCamera.html#a8c0cbb34989ca19042be8b90c176fc47" title="Return the height of the camera. ">GetHeight()</a> * sizeof(float) * 4</code></td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">zeroCopy</td><td>If <code>true</code>, the image will reside in shared CPU/GPU memory. If <code>false</code>, the image will only be accessible from the GPU. You would need to set zeroCopy to <code>true</code> if you wanted to access the image pixels from the CPU. Since this isn't generally the case, the default is <code>false</code> (GPU only).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, <code>false</code> if an error occurred. </dd></dl>

</div>
</div>
<a id="a1747140a15dd83dbd3593c375bbc85d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1747140a15dd83dbd3593c375bbc85d0">&#9670;&nbsp;</a></span>Create() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classgstCamera.html">gstCamera</a>* gstCamera::Create </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>camera</em> = <code>NULL</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create a MIPI CSI or V4L2 camera device. </p>
<p><a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> will use the <code>nvarguscamerasrc</code> GStreamer element for MIPI CSI cameras, and the <code>v4l2src</code> GStreamer element for capturing V4L2 cameras, like USB webcams.</p>
<p>The camera will be created with a resolution indicated by <a class="el" href="classgstCamera.html#a211a6c9359a2f43054771f15e7628a5e" title="Default camera width, unless otherwise specified during Create() ">gstCamera::DefaultWidth</a> and <a class="el" href="classgstCamera.html#a42ab558b8ff9a0bf47b768c5122825b7" title="Default camera height, unless otherwise specified during Create() ">gstCamera::DefaultHeight</a> (1280x720 by default).</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">camera</td><td>Camera device to use. If using MIPI CSI, this string can be <code>NULL</code> to default to CSI camera 0, otherwise the string should contain the device index of the CSI camera (e.g. <code>"0"</code> for CSI camera 0 or <code>"1"</code> for CSI camera 1, ect). If using V4L2, the string should contain the <code>/dev/video</code> node to use (e.g. <code>"/dev/video0"</code> for V4L2 camera 0). By default, <code>camera</code> parameter is NULL and MIPI CSI camera 0 is used.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the created <a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> device, or NULL if there was an error. </dd></dl>

</div>
</div>
<a id="a4e35c53ac1d65ba5c0319278ca097766"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4e35c53ac1d65ba5c0319278ca097766">&#9670;&nbsp;</a></span>Create() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classgstCamera.html">gstCamera</a>* gstCamera::Create </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>camera</em> = <code>NULL</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Create a MIPI CSI or V4L2 camera device. </p>
<p><a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> will use the <code>nvarguscamerasrc</code> GStreamer element for MIPI CSI cameras, and the <code>v4l2src</code> GStreamer element for capturing V4L2 cameras, like USB webcams.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">width</td><td>desired width (in pixels) of the camera resolution. This should be from a format that the camera supports.</td></tr>
    <tr><td class="paramname">height</td><td>desired height (in pixels) of the camera resolution. This should be from a format that the camera supports.</td></tr>
    <tr><td class="paramname">camera</td><td>Camera device to use. If using MIPI CSI, this string can be <code>NULL</code> to default to CSI camera 0, otherwise the string should contain the device index of the CSI camera (e.g. <code>"0"</code> for CSI camera 0 or <code>"1"</code> for CSI camera 1, ect). If using V4L2, the string should contain the <code>/dev/video</code> node to use (e.g. <code>"/dev/video0"</code> for V4L2 camera 0). By default, <code>camera</code> parameter is NULL and MIPI CSI camera 0 is used.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the created <a class="el" href="classgstCamera.html" title="MIPI CSI and V4L2 camera capture using GStreamer and nvarguscamerasrc or v4l2src elements. ">gstCamera</a> device, or NULL if there was an error. </dd></dl>

</div>
</div>
<a id="a8c0cbb34989ca19042be8b90c176fc47"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c0cbb34989ca19042be8b90c176fc47">&#9670;&nbsp;</a></span>GetHeight()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t gstCamera::GetHeight </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the height of the camera. </p>

</div>
</div>
<a id="abe5444efa860b29c8ce2dff6e3e16dcd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abe5444efa860b29c8ce2dff6e3e16dcd">&#9670;&nbsp;</a></span>GetPixelDepth()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t gstCamera::GetPixelDepth </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the pixel bit depth of the camera (measured in bits). </p>
<p>This will be 12 for MIPI CSI cameras (YUV NV12 format) or 24 for VL42 cameras (RGB 24-bit). </p>

</div>
</div>
<a id="a6f02cf79d67b1c204f53a1c7fa369374"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6f02cf79d67b1c204f53a1c7fa369374">&#9670;&nbsp;</a></span>GetSize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t gstCamera::GetSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the size (in bytes) of a camera frame from <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a>. </p>
<dl class="section note"><dt>Note</dt><dd>this is not the size of the converted float4 RGBA image from Convert(), but rather the YUV (NV12) or RGB (24-bit) image that gets aquired by the <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> function. To calculate the size of the converted float4 RGBA image, take: <code><a class="el" href="classgstCamera.html#a01e94b6f2abedad9ab760dd68b828e80" title="Return the width of the camera. ">GetWidth()</a> * <a class="el" href="classgstCamera.html#a8c0cbb34989ca19042be8b90c176fc47" title="Return the height of the camera. ">GetHeight()</a> * sizeof(float) * 4</code> </dd></dl>

</div>
</div>
<a id="a01e94b6f2abedad9ab760dd68b828e80"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a01e94b6f2abedad9ab760dd68b828e80">&#9670;&nbsp;</a></span>GetWidth()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t gstCamera::GetWidth </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the width of the camera. </p>

</div>
</div>
<a id="a7142cbf3d2251c023967affa0625ac74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7142cbf3d2251c023967affa0625ac74">&#9670;&nbsp;</a></span>IsStreaming()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool gstCamera::IsStreaming </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if the camera is streaming or not. </p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> if the camera is streaming (open), or <code>false</code> if it's closed. </dd></dl>

</div>
</div>
<a id="a075aa94acb72f577f7c385e37a8c15b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a075aa94acb72f577f7c385e37a8c15b0">&#9670;&nbsp;</a></span>Open()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool gstCamera::Open </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Begin streaming the camera. </p>
<p>After <a class="el" href="classgstCamera.html#a075aa94acb72f577f7c385e37a8c15b0" title="Begin streaming the camera. ">Open()</a> is called, frames from the camera will begin to be captured.</p>
<p><a class="el" href="classgstCamera.html#a075aa94acb72f577f7c385e37a8c15b0" title="Begin streaming the camera. ">Open()</a> is not stricly necessary to call, if you call one of the <a class="el" href="classgstCamera.html#a1ae42b24f1ccb8056252614aae6779e5" title="Capture the next image frame from the camera. ">Capture()</a> functions they will first check to make sure that the stream is opened, and if not they will open it automatically for you.</p>
<dl class="section return"><dt>Returns</dt><dd><code>true</code> on success, <code>false</code> if an error occurred opening the stream. </dd></dl>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a42ab558b8ff9a0bf47b768c5122825b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a42ab558b8ff9a0bf47b768c5122825b7">&#9670;&nbsp;</a></span>DefaultHeight</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const uint32_t gstCamera::DefaultHeight = 720</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Default camera height, unless otherwise specified during <a class="el" href="classgstCamera.html#a1747140a15dd83dbd3593c375bbc85d0" title="Create a MIPI CSI or V4L2 camera device. ">Create()</a> </p>

</div>
</div>
<a id="a211a6c9359a2f43054771f15e7628a5e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a211a6c9359a2f43054771f15e7628a5e">&#9670;&nbsp;</a></span>DefaultWidth</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const uint32_t gstCamera::DefaultWidth = 1280</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Default camera width, unless otherwise specified during <a class="el" href="classgstCamera.html#a1747140a15dd83dbd3593c375bbc85d0" title="Create a MIPI CSI or V4L2 camera device. ">Create()</a> </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>jetson-utils/<a class="el" href="gstCamera_8h_source.html">gstCamera.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classgstCamera.html">gstCamera</a></li>
    <li class="footer">Generated on Fri Jun 21 2019 16:23:15 for Jetson Inference by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
